package crafex.resource.items;

import crafex.engine.entities.InventoryItem;
import crafex.engine.tools.IntVertex2D;
import crafex.resource.items.gunparts.GunPart;
import crafex.resource.items.gunparts.Stock;


public abstract class Gun extends InventoryItem{

	public enum GunTypes{
		pistol;
	}
	
	protected boolean special = false;
	
	//TODO finish gun class after gun parts
	
	public GunPart receiver;
	public GunPart barrel;
	public GunPart grip;
	public GunPart barrelaccessory;
	public Stock stock;
	public GunPart mag;
	public GunPart triggerassembly;
	
	protected String name;
	protected int _magsize;
	protected int _inmag;
	
	protected float _damage;
	protected float _accuracy;
	
	
	
	
	
	public Gun(){
		super(1, new IntVertex2D(1, 1));
	}
	
	public Gun(int id, IntVertex2D length) {
		super(id, length);
		
	}
	
//	public static GunParts[] getGunParts(GunTypes guntype){
//		if(guntype == GunTypes.pistol){
//			GunParts[] data = {GunParts.barrel, GunParts.grip};
//			return data;
//		}else{
//			return null;
//		}
//	}
	
	public boolean isSpecial() {
		return special;
	}

	public void setSpecial(boolean special) {
		this.special = special;
	}

	public GunPart getReceiver() {
		return receiver;
	}

	public void setReceiver(GunPart receiver) {
		this.receiver = receiver;
	}

	public GunPart getBarrel() {
		return barrel;
	}

	public void setBarrel(GunPart barrel) {
		this.barrel = barrel;
	}

	public GunPart getGrip() {
		return grip;
	}

	public void setGrip(GunPart grip) {
		this.grip = grip;
	}

	public GunPart getBarrelaccessory() {
		return barrelaccessory;
	}

	public void setBarrelaccessory(GunPart barrelaccessory) {
		this.barrelaccessory = barrelaccessory;
	}

	public Stock getStock() {
		return stock;
	}

	public void setStock(Stock stock) {
		this.stock = stock;
	}

	public GunPart getMag() {
		return mag;
	}

	public void setMag(GunPart mag) {
		this.mag = mag;
	}

	public GunPart getTriggerassembly() {
		return triggerassembly;
	}

	public void setTriggerassembly(GunPart triggerassembly) {
		this.triggerassembly = triggerassembly;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public abstract String[] saveGun();
	public abstract void loadGun(String[] data);

	public void updateStats(){
		//TODO make update status on gun
	}
	

}
